package com.mlethe.android.demo.banner;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.mlethe.android.demo.R;
import com.mlethe.android.demo.banner.adapter.RecyclerAdapter;
import com.mlethe.library.widget.banner.BannerView;

import java.util.ArrayList;
import java.util.List;

public class TestActivity extends AppCompatActivity {

    private BannerView bannerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_banner_test);
        /*bannerView = findViewById(R.id.main_banner_view);
        List<String> list = new ArrayList<>();
        list.add("http://pic37.nipic.com/20140113/8800276_184927469000_2.png");
        list.add("http://pic37.nipic.com/20140113/8800276_184927469000_2.png");
        list.add("http://pic37.nipic.com/20140113/8800276_184927469000_2.png");
        list.add("http://pic37.nipic.com/20140113/8800276_184927469000_2.png");
        bannerView.setBannerListener(new BannerView.OnBannerListener() {
            @Override
            public void OnBannerClick(int position) {
                Toast.makeText(TestActivity.this, "点击了 position->" + position, Toast.LENGTH_SHORT).show();
            }
        }).setAdapter(new BannerImgAdapter(list));*/

        RecyclerView recyclerView = findViewById(R.id.recyclerView);
        RecyclerAdapter adapter = new RecyclerAdapter(getData(20));
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(adapter);
    }

    private List<String> getData(int length) {
        List<String> list = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            list.add("item" +  (i + 1));
        }
        return list;
    }
}
